package com.eshop.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eshop.domain.BaseDomain;

@TableName("dept")
public class Dept extends BaseDomain
{
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @NotBlank(message = "部门名称不能为空")
    private String name;
    @NotNull(message = "上级部门不能为空")
    private Long pid;
    private Boolean enabled;
    
    public void copy(final Dept source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
    
    public Long getId() {
        return this.id;
    }
    
    public String getName() {
        return this.name;
    }
    
    public Long getPid() {
        return this.pid;
    }
    
    public Boolean getEnabled() {
        return this.enabled;
    }
    
    public void setId(final Long id) {
        this.id = id;
    }
    
    public void setName(final String name) {
        this.name = name;
    }
    
    public void setPid(final Long pid) {
        this.pid = pid;
    }
    
    public void setEnabled(final Boolean enabled) {
        this.enabled = enabled;
    }
    
    public String toString() {
        return "Dept(id=" + this.getId() + ", name=" + this.getName() + ", pid=" + this.getPid() + ", enabled=" + this.getEnabled() + ")";
    }
    
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof Dept)) {
            return false;
        }
        final Dept other = (Dept)o;
        if (!other.canEqual(this)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        final Object this$id = this.getId();
        final Object other$id = other.getId();
        Label_0075: {
            if (this$id == null) {
                if (other$id == null) {
                    break Label_0075;
                }
            }
            else if (this$id.equals(other$id)) {
                break Label_0075;
            }
            return false;
        }
        final Object this$pid = this.getPid();
        final Object other$pid = other.getPid();
        Label_0112: {
            if (this$pid == null) {
                if (other$pid == null) {
                    break Label_0112;
                }
            }
            else if (this$pid.equals(other$pid)) {
                break Label_0112;
            }
            return false;
        }
        final Object this$enabled = this.getEnabled();
        final Object other$enabled = other.getEnabled();
        Label_0149: {
            if (this$enabled == null) {
                if (other$enabled == null) {
                    break Label_0149;
                }
            }
            else if (this$enabled.equals(other$enabled)) {
                break Label_0149;
            }
            return false;
        }
        final Object this$name = this.getName();
        final Object other$name = other.getName();
        if (this$name == null) {
            if (other$name == null) {
                return true;
            }
        }
        else if (this$name.equals(other$name)) {
            return true;
        }
        return false;
    }
    
    protected boolean canEqual(final Object other) {
        return other instanceof Dept;
    }
    
    public int hashCode() {
        final int PRIME = 59;
        int result = super.hashCode();
        final Object $id = this.getId();
        result = result * 59 + (($id == null) ? 43 : $id.hashCode());
        final Object $pid = this.getPid();
        result = result * 59 + (($pid == null) ? 43 : $pid.hashCode());
        final Object $enabled = this.getEnabled();
        result = result * 59 + (($enabled == null) ? 43 : $enabled.hashCode());
        final Object $name = this.getName();
        result = result * 59 + (($name == null) ? 43 : $name.hashCode());
        return result;
    }
}
